using UnityEngine;
using System.Collections;

public class SelectObjectByClick : MonoBehaviour {
	
	public static bool wasRotatingCam = false;
	
	// Update is called once per frame
	void Update () 
	{
		if (Input.GetMouseButtonUp(0)) // Left click
		{
			if(!wasRotatingCam)
			{
				RaycastHit hitInfo;
	            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
	            if (Physics.Raycast(ray, out hitInfo))
				{
	                Debug.DrawRay(ray.origin, ray.direction * 10, Color.yellow);
					print("Clicked " + hitInfo.collider.gameObject.name + "!");
				}
			}
        }
	}
}
